package org.linlinjava.litemall.wx.config;
import org.linlinjava.litemall.wx.interceptor.TraceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: weilai
 * @date: 2019/12/26
 * @description:
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Bean
    public TraceInterceptor getSignatureInterceptor(){
        return new TraceInterceptor();
    }
    /**
     * 注册拦截器
     * @param registry registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getSignatureInterceptor())
                .addPathPatterns("/wx/commodity/list","/wx/commodity/detail");
    }
}
